<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>组件的模板分离式写法</title>
</head>
<body>
<div id="app">
    <cpn></cpn>
</div>

<template id="cpn">
    <h1>这是一个自定义组件</h1>
    <div>Hello, Vue Component!</div>
</template>

<script type="module">
    import {createApp, defineComponent} from "../../../js/vue.esm-browser.js";

    let component = defineComponent(
        {
            template: "#cpn"
        }
    );

    let app = createApp(
        {
            setup() {
                return {}
            }
        }
    );

    app.component("cpn", component)

    app.mount("#app")
</script>
</body>
</html>